package net.wzw.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.wzw.service.FoodCounterService;
import net.wzw.utils.ApiResult;
import net.wzw.vo.FoodCounterVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wzw
 * @date 2025/5/1
 * @Description
 */
@Api(tags = "社交微服务计数模块")
@Slf4j
@RestController
@RequestMapping("/api/social/v1/")
public class FoodCounterController {

    /**
     * 注入美食计数微服务
     * **/
    @Autowired
    private FoodCounterService foodCounterService ;

    /**
     * 获取美食计数信息
     * @param foodId
     * @return
     */
    @ApiOperation("获取美食计数信息")
    @PostMapping("/getFoodCounter")
    public ApiResult getFoodCounter(@RequestBody Long foodId){

        log.info("获取美食计数信息,foodId:{}",foodId);

       List<FoodCounterVO> result =   foodCounterService.getFoodCpunter(foodId);

       return  ApiResult.doSuccess(result);

    }

    /**
     * 删除美食计数信息
     * @param foodId
     * @return
     */
    @ApiOperation("删除美食计数信息")
    @PostMapping("/delFoodCounter")
     public ApiResult delFoodCounter(@RequestBody Long foodId){

        log.info("删除美食计数信息,foodId:{}",foodId);

        foodCounterService.delFoodCounter(foodId);

         return  ApiResult.doSuccess();

     }


}
